/*
 * Copyright © 2009 Gerald Isaac Schwarz
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package base;

import java.awt.Color;

public class Player {
	private String name, type;
	private Color color;
	private int id;
	
	/**
	 * Class constants for different types of players.
	 */
	public static final String HUMAN = "Human", COMPUTER = "Computer";
	
	/**
	 * Get the player's name.
	 * @return A String that represents the player's name.
	 */
	public String getName() {
		return this.name;
	}
	
	void setName(String name) {
		this.name = name;
	}
	
	/**
	 * Get the player's type.
	 * @return A String that represents the player's type.
	 */
	public String getType() {
		return this.type;
	}
	
	/**
	 * Get the player's color.
	 * @return The color that represents the player.
	 */
	public Color getColor() {
		return new Color(this.color.getRed(), this.color.getGreen(), this.color.getBlue(), this.color.getAlpha());
	}
	
	void setColor(Color color) {
		this.color = new Color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha());
	}
	
	public int getId() {
		return this.id;
	}
	
	/**
	 * Create a new player.
	 * @param name A String that represents the player's name.
	 * @param color A Color that represents the player's color.
	 * @param direction An int that represents the direction in which the player's pieces are moving.
	 */
	public Player(String name, int id, Color color) {
		this.name = name;
		this.id = id;
		this.color = color;
		this.type = Player.HUMAN;
	}
	
	public String toString() {
		return this.getName();
	}

	public void setId(int id) {
		this.id = id;
	}
}
